from time import sleep
import uiautomation
import pyautogui
class huajiashoufei():
        his = uiautomation.WindowControl(searchDepth=1, Name='科玛奇医院信息管理系统')  # 锁定窗口
        his.SetFocus()
        #居民处方列表
        jumingchufangliebiao = his.CustomControl(AutomationId='mzhjsfWin', ClassName='MZHuaJiaShouFei').ButtonControl(AutomationId='btnHuanzheList', ClassName='Button',Name='居民处方列表')
        jumingxinxizu = his.GroupControl(AutomationId='groupBoxHuanzhe', ClassName='GroupBox',Name='居民信息')
        jumingxinxizu_xingming = jumingxinxizu.EditControl(AutomationId='jmxx_xm_txt', ClassName='TextBox')
        jumingxinxizu_chaxun = jumingxinxizu.ButtonControl(AutomationId='jmxx_search_btn', ClassName='Button',Name='查询')
        jumingxinxizu_shuju1 = jumingxinxizu.DataItemControl(ClassName='DataGridRow',Name='Ksy.ChssClient.Access.Model.SQ_JMFWDJ',foundIndex=1)
        jumingxinxizu_shuju2 = jumingxinxizu.DataItemControl(ClassName='DataGridRow',Name='Ksy.ChssClient.Access.Model.SQ_JMFWDJ',foundIndex=2)
        jumingxinxizu_shuju3 = jumingxinxizu.DataItemControl(ClassName='DataGridRow',Name='Ksy.ChssClient.Access.Model.SQ_JMFWDJ',foundIndex=3)
        jumingxinxizu_shuju4 = jumingxinxizu.DataItemControl(ClassName='DataGridRow',Name='Ksy.ChssClient.Access.Model.SQ_JMFWDJ',foundIndex=4)

        menzhengchufangxuanzhe = his.WindowControl(AutomationId='winMZCFChooseList', ClassName='Window',Name='门诊处方选择')
        menzhengchufangxuanzhe_queding = menzhengchufangxuanzhe.ButtonControl(ClassName='Button',Name='确定')
        menzhengchufangxuanzhe_quxiao = menzhengchufangxuanzhe.ButtonControl(ClassName='Button', Name='取消')

        youhuijianmian = his.EditControl(AutomationId='yhjm_ntbebft', ClassName='TextBox')#优惠减免
        xianjinzhifu = his.CheckBoxControl(AutomationId='zf_xj_cbbft', ClassName='CheckBox',Name='现金支付')#现金支付复选框
        shoufeibaocun = his.ButtonControl(AutomationId='btnSave', ClassName='Button',Name='收费保存(F6)')#收费保存
        yulanguanbi = his.WindowControl(ClassName='Window',Name='预览').ButtonControl(ClassName='Button',Name='关闭')

        #点击居民处方列表
        def click_jmcflb_btn(self):
                self.jumingchufangliebiao.Click()
        #输入患者姓名查询
        def input_lbxm(self,name):
                self.jumingxinxizu_xingming.SendKeys(name)
        #点击查询按钮
        def click_cx_btn(self):
                self.jumingxinxizu_chaxun.Click()
        #点击第一条数据
        def click_sj1(self):
                self.jumingxinxizu_shuju1.DoubleClick()
        #点击第二条数据
        def click_sj2(self):
                self.jumingxinxizu_shuju2.DoubleClick()
        #点击第三条数据
        def click_sj3(self):
                self.jumingxinxizu_shuju3.DoubleClick()

        #点击门诊处方选择确定按钮
        def click_qd_btn(self):
                self.menzhengchufangxuanzhe_queding.Click()

        #输入优惠减免
        def input_yhjm(self,num):
                self.youhuijianmian.SendKeys(num)
        #点击现金支付复选框
        def click_xjzf_btn(self):
                self.xianjinzhifu.Click()
        #点击收费保存按钮
        def click_sfbc_btn(self):
                self.shoufeibaocun.Click()

        #点击预览关闭按钮
        def click_ylgb_btn(self):
                self.yulanguanbi.Click()
